package com.yuan.base.utils;

import android.content.Context;

import com.yuan.base.widget.iosDialog.IosProgress;


/**
 */
public class ProgressUtil {

	private static IosProgress dialog;

	public static IosProgress show(Context context, String msg) {
		if (dialog != null && dialog.isShowing()) {
			dialog.setLabel(msg);
		} else {
			dialog = buildDialog(context, msg).show();
			dialog.setCancellable(false);
		}
		return dialog;
	}

	public static IosProgress buildDialog(Context context, String msg) {
		return IosProgress.create(context)
				.setStyle(IosProgress.SPIN_INDETERMINATE)
				.setLabel(msg)
				.setCancellable(false)
				.setDimAmount(0.5f);
	}

	public static void hide() {
		if (dialog != null && dialog.isShowing()) {
			dialog.dismiss();
		}
	}
}
